/**
 * @param {number[]} nums
 * @return {number[]}
 */
 var missingTwo = function(nums) {
   let n = nums.length+2
  let sum = 0
  for(const i of nums){
    sum+= i
  }
  let midsum = (1+n)*n /2 - sum
  let mid = Math.floor(midsum / 2)
  sum =0
  for(const i of nums){
    if(i<=mid) {
      sum +=i
    }
  }
  let res = (1+mid)*mid /2 - sum
  return [res,midsum-res]
};


console.log(missingTwo([2,3]));